using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace Xfinity.Debugging.Visualizers
{
    public delegate void UpdateDelegate(GameTime gameTime);
    public delegate void DrawDelegate(GameTime gameTime);
    public delegate void InitDelegate();
    public delegate void LoadGraphicsDelegate(bool loadAllContent);

    class TestGameRig:Game
    {
        UpdateDelegate update;
        DrawDelegate draw;
        InitDelegate init;
        LoadGraphicsDelegate load;
        public TestGameRig(UpdateDelegate update, DrawDelegate draw, InitDelegate init, LoadGraphicsDelegate load):base()
        {
            this.update = update;
            this.draw = draw;
            this.init = init;
            this.load = load;
        }
        protected override void Update(GameTime gameTime)
        {
            if (update==null)
            {
                return;
            }
            update(gameTime);
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            if (draw == null)
            {
                return;
            }
            draw(gameTime);
            base.Draw(gameTime);
        }
        public void Init()
        {
            Initialize();
        }
        protected override void Initialize()
        {
            if (init == null)
            {
                return;
            }
            init();
            base.Initialize();
        }
        protected override void LoadGraphicsContent(bool loadAllContent)
        {
            if (load== null)
            {
                return;
            }
            load(loadAllContent);
            base.LoadGraphicsContent(loadAllContent);
        }
    }
}
